//
//  ViewController.m
//  TestSDWebImage
//
//  Created by ehang on 16/9/9.
//  Copyright © 2016年 ehang. All rights reserved.
//

#import "ViewController.h"
#import "UIImageView+WebCache.h"

@interface ViewController ()

@property(nonatomic, assign) NSUInteger uinteger;// 默认值是0

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    
    NSFileManager *filemanager = [NSFileManager defaultManager];
    NSFileManager *fileManager2 = [NSFileManager new];
    NSLog(@"%@ , %@",filemanager , fileManager2);
    //2016-09-09 20:49:42.876 TestSDWebImage[16114:1112815] <NSFileManager: 0x7feb187069b0> , <NSFileManager: 0x7feb1860ede0>
    
    // !10 等于 0
    NSLog(@"默认的_uinteger = %zd   ,  !10 = %zd",_uinteger , !10);

    CGFloat height = 100;
    
    NSArray *imageUrls = @[
                           @"http://upload-images.jianshu.io/upload_images/1455933-597296ec3f5594a0.gif?imageMogr2/auto-orient/strip",
                           @"http://upload-images.jianshu.io/upload_images/1455933-1b3f77d0f122d42e.gif?imageMogr2/auto-orient/strip",
                           @"http://upload-images.jianshu.io/upload_images/1455933-e3f013f10aa2a647.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240"
                           ];
    
    for (int i = 0 ; i < 3; i ++) {
        UIImageView *imageView = [[UIImageView alloc] init];
        imageView.frame = CGRectMake(100, 110 * (i + 1), 100, height);
        [self.view addSubview:imageView];
        [imageView sd_setImageWithURL:imageUrls[i] placeholderImage:nil options:SDWebImageRetryFailed | SDWebImageRefreshCached progress:^(NSInteger receivedSize, NSInteger expectedSize) {
            NSLog(@"progress : %f",receivedSize * 1.0 / expectedSize);
        } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
            NSLog(@"%zd  ,  %@",cacheType,imageURL);
        }];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];


}

@end
